<?php

class Additional {

// Generate a random character string
function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')
{
    // Length of character list
    $chars_length = (strlen($chars) - 1);

    // Start our string
    $string = $chars{rand(0, $chars_length)};

    // Generate random string
    for ($i = 1; $i < $length; $i = strlen($string))
    {
        // Grab a random character from our list
        $r = $chars{rand(0, $chars_length)};

        // Make sure the same two characters don't appear next to each other
        if ($r != $string{$i - 1}) $string .=  $r;
    }

    // Return the string
    return $string;
}
public function sendEmail($body,$to,$subject){
                    // Send notification email to owner that the application will be evaluated
                $setting = new Application_Model_DbTable_Settings();
                $from = array("admin@bitz-plaza.com"=>"Bitz-Plaza Admin");
                require_once 'Bitzero/Mail/Smtp.php';
                $config = array('ssl' => 'ssl',
                  'port' => $setting->getSetting('smtp_port'),
                  'auth' => 'login',
                  'username' => 'bitzplaza@gmail.com',
                  'password' => 'bitzplazadotcom' );
                $smtp = new Bitzero_Mail_Smtp('smtp.gmail.com', $config);
                $smtp->send($to, $from, $subject, $body);
              
    }
  public  function birthday ($birthday){
    list($year,$month,$day) = explode("-",$birthday);
    $year_diff  = date("Y") - $year;
    $month_diff = date("m") - $month;
    $day_diff   = date("d") - $day;
    if ($day_diff < 0 || $month_diff < 0)
      $year_diff--;
    return $year_diff;
  }
    public function monthConverter ($date){

    $date = explode(" ", $date);
    $dates = explode('-',$date[0]);
    $int = (int)$dates[1];
    $month=array(1=>'Januari',2=>'Februari',3=>'Maret',4=>'April',5=>'Mei',
                 6=>'Juni',7=>'Juli',8=>'Agustus',9=>'September',10=>'Oktober',
                 11=>'November',12=>'Desember');
    return $dates[2]." ".$month[$int].",".$dates[0];
  }
}
?>